<!DOCTYPE html>
<!-- saved from url=(0084)https://y.qq.com/portal/list_recover.html#stat=y_new.profile.create_playlist.recover -->
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="mobile-agent" content="format==[html5];url=https://y.qq.com/m/index.html">
    <meta name="applicable-device" content="pc">
    <title>歌单恢复 - QQ音乐-千万正版音乐海量无损曲库新歌热歌天天畅听的高品质音乐平台！</title>
    <link rel="canonical" href="https://y.qq.com/portal/list_recover.html">

<script id="requirenode" async="" src="/static/songlist/js/mod.js"></script>

    <link rel="stylesheet" href="/static/songlist/css/layout_0412.css">
    <link rel="stylesheet" href="/static/css/recover.css">
<link rel="stylesheet" href="/static/songlist/css/popup_login.css"><style type="text/css">.emojicon-m {min-height: 1em !important; min-width: 1em !important; max-height: 1em !important;max-width: 1em !important;vertical-align: middle !important;float: none !important;background-repeat:no-repeat;background-position:center center;	background-size: contain;display: inline-block;}</style><link rel="stylesheet" type="text/css" href="/static/songlist/css/qb-ie-remind.css"><!--[if lt IE 8]><script src='//stdl.qq.com/stdl/qb/js/json2.js'></script><![endif]--><script charset="utf-8" async="" src="/static/songlist/js/qblog.js"></script></head>
<body class="os_mac">

<!--外框架 S-->
<div class="sb_scrollable sb_main sb_viewport">
    <div class="layout_page js_layout_page">
        <div class="layout_cont">
            <!--恢复歌单-->
            <div class="content js_playlist_content">
                <div class="content__header">
                    <h1 class="recover__title">歌单恢复</h1>
                    <p class="recover__intro">为你提供最近1个月内被删除歌单的恢复服务，恢复约5~10秒生效</p>
                    <p class="recover__opt"><a class="mod_btn js_recover_playlist" href="javascript:;" data-btntype="0"><span class="icon_recover"></span>恢复所选歌单<i class="bg"></i></a><a class="mod_btn js_delete_playlist" href="javascript:;" data-btntype="1"><span class="icon_delete"></span>删除所选歌单<i class="bg"></i></a></p>
                </div>
                <div class="content__detail">
                    <div class="song">
                        <div class="song__header">
                            <p class="type__select"><input class="select__song js_all_select" type="checkbox"></p>
                            <p class="type__name">歌单</p>
                            <p class="type__state">删除状态</p>
                            <p class="type__date">删除时间</p>
                        </div>
                        <ul class="song__list playlist js_playlist_list"><li class="song__list__item js_playlist_item" data-id="3323885023"><span class="song__select js_item_span"><input class="select__song js_item_select" name="subBox" type="checkbox"></span><a href="javascript:;" class="js_playlist_detail"><span class="song__title" title="我喜欢"><img src="/static/songlist/css/cover_love_130.jpg" onerror="this.src=&#39;//y.gtimg.cn/mediastyle/global/img/cover_playlist.png?max_age=31536000&#39;;this.onerror=null;" alt="我喜欢">我喜欢</span></a><span class="song__state">84首歌被删除</span><span class="song__delete_date">2019年12月3日 16:19</span></li><li class="song__list__item js_playlist_item" data-id="3323885027"><span class="song__select js_item_span"><input class="select__song js_item_select" name="subBox" type="checkbox"></span><a href="javascript:;" class="js_playlist_detail"><span class="song__title" title="默认收藏"><img src="/static/songlist/css/cover_playlist.png" onerror="this.src=&#39;//y.gtimg.cn/mediastyle/global/img/cover_playlist.png?max_age=31536000&#39;;this.onerror=null;" alt="默认收藏">默认收藏</span></a><span class="song__state">21首歌被删除</span><span class="song__delete_date">2018年5月15日 10:45</span></li><li class="song__list__item js_playlist_item" data-id="3323885026"><span class="song__select js_item_span"><input class="select__song js_item_select" name="subBox" type="checkbox"></span><a href="javascript:;" class="js_playlist_detail"><span class="song__title" title="我最爱听"><img src="/static/songlist/css/cover_playlist.png" onerror="this.src=&#39;//y.gtimg.cn/mediastyle/global/img/cover_playlist.png?max_age=31536000&#39;;this.onerror=null;" alt="我最爱听">我最爱听</span></a><span class="song__state">1首歌被删除</span><span class="song__delete_date">2018年5月15日 10:45</span></li></ul>
                    </div>
                </div>
            </div>
            <!--没有可以恢复的歌单-->
            <div class="content js_content_null" style="display: none">
                <div class="content__header">
                    <h1 class="recover__title">歌单恢复</h1>
                    <p class="recover__intro">为你提供最近1个月内被删除歌单的恢复服务，恢复约5~10秒生效</p>
                </div>
                <div class="content__detail">
                    <div class="nofollow">空空如也，暂无歌单可以被恢复</div>
                </div>
            </div>
            <!--没有可以恢复的歌单-->
            <div class="content js_song_null" style="display: none">
                <div class="content__header">
                    <h1 class="recover__title js_song_name">歌曲恢复</h1>
                    <p class="recover__intro js_song_intro"></p>
                </div>
                <div class="content__detail">
                    <div class="nofollow">空空如也，暂无歌曲可以被恢复</div>
                </div>
            </div>
            <!--恢复歌单内歌曲-->
            <div class="content js_songlsit_content" style="display: none">
                <div class="content__header">
                    <h1 class="recover__title js_recover_title"></h1>
                    <p class="recover__intro js_songlist_intro"></p>
                    <p class="recover__opt"><a class="mod_btn js_recover_songlist" href="javascript:;" data-btntype="0"><span class="icon_recover"></span>恢复所选歌曲<i class="bg"></i></a><a class="mod_btn js_delete_songlist" href="javascript:;" data-btntype="1"><span class="icon_delete"></span>删除所选歌曲<i class="bg"></i></a></p>
                </div>
                <div class="content__detail">
                    <div class="song">
                        <div class="song__header">
                            <p class="type__select"><input class="select__song js_all_select_" type="checkbox"></p>
                            <p class="type__name">歌曲</p>
                            <p class="type__state">歌手</p>
                            <p class="type__album">专辑</p>
                        </div>
                        <ul class="song__list js_song_list song__list_base">
                        </ul>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<!--外框架 E-->

<script type="text/javascript">
    window.setIframeHeight = function() {
        var iframe = document.getElementById('content_iframe')
        if (iframe) {
            var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
            if (iframeWin.document.body) {
                var hhh = (iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight);
                iframe.height = hhh;
            }
        }
    };
    (function () {
        require.async("js/common/music.js", function(music){
            window.popup = music.popup;
            window.g_popup = {};
            window.g_popup.show = function(title, desc, btn, cb){
                require.async("js/common/dialog.js", function (dialog) {
                    dialog.show({
                        mode: "common",
                        title: "QQ音乐",
                        icon_type: 2,
                        sub_title: title,
                        desc: desc,
                        button_info1: {
                            highlight: 1,
                            title: btn || '确定',
                            fn: function () {
                                dialog.hide();
                                cb && cb();
                            }
                        },
                        button_info2: {
                            highlight: 0,
                            title: "取消",
                            fn: function (e) {
                                dialog.hide();
                            }
                        }
                    });
                });
            }
        });
    })();
    require.async('js/common/music.js', function (music) {
        var jQueryAjax = music.jQueryAjax,
			$ = music.$,
            User = music.widget.user,
			statistics = music.statistics,
            $nullCnt = $('.js_content_null'),
            $nullsong = $('.js_song_null'),
            $playlistCnt = $('.js_playlist_content'),
            $songlistCnt = $('.js_songlsit_content'),
            itemId = [],
            isPlaylist = true,
            globalId = 0;

        (function(){

            function formatDate(unixTime) {
                var curDate = new Date(),
                        curDate_y = curDate.getFullYear(),
                        curDate_m = curDate.getMonth() + 1,
                        curDate_d = curDate.getDate();

                if (unixTime > 0) {
                    unixTime = new Date(unixTime * 1000);
                    if (unixTime == "Invalid Date") {
                        return "";
                    }
                    var y = unixTime.getFullYear();
                    var m = unixTime.getMonth() + 1;
                    var d = unixTime.getDate();
                    var h = unixTime.getHours();
                    var mm = unixTime.getMinutes();
                    var str = "";
                    if (y != curDate_y) {
                        str += y + "年";
                    }
                    if (y != curDate_y || m != curDate_m || d != curDate_d) {
                        str += m + "月" + d + "日 ";
                    }
                    return str + (h < 10 ? ("0" + h) : h) + ":" + (mm < 10 ? ("0" + mm) : mm);
                } else {
                    return ""
                }
            }

            function getRecyclerList(callback){
                var url = location.protocol + '//c.y.qq.com/folder/fcgi-bin/fcg_fav_recycler_getlist.fcg?uin=' + User.getUin();
                jQueryAjax.json({
                    url: url,
                    charset : 'utf-8',
                    success : function(data) {

                        if(!data || data.code != 0) {
                            return;
                        }
                        typeof callback == 'function' && callback(data.data);
                    },
                    error : function(){
                    }
                });
            }

            function renderRecyclerList(data){
                if (data.dir_num == 0 || !data.dir_list) {
                    $nullCnt.show();
                    $nullsong.hide();
                    $playlistCnt.hide();
                    $songlistCnt.hide();
                    return;
                }

                var item = null;
				var html = [];

                for (var i = 0, l = data.dir_list && data.dir_list.length; i < l; i++) {
                    item = data.dir_list[i];
                    item.delete_time = formatDate(item.delete_time);
                    item.statusTxt = item.delete_flag == 1 ? '歌单被删除' : (item.song_num && item.song_num + '首歌被删除');
					html.push(['<li class="song__list__item js_playlist_item" data-id="'+item.dir_global_id+'">',
						'<span class="song__select js_item_span"><input class="select__song js_item_select" name="subBox" type="checkbox"></span>',
						'<a href="javascript:;" class="js_playlist_detail"><span class="song__title" title="'+item.dir_name.HtmlEncode()+'"><img src="'+music.util.fixUrl(item.dir_pic_url)+'" onerror="this.src=\'//y.gtimg.cn/mediastyle/global/img/cover_playlist.png?max_age=31536000\';this.onerror=null;"  alt="'+item.dir_name.HtmlEncode()+'">'+item.dir_name.HtmlEncode()+'</span></a>',
						'<span class="song__state">'+item.statusTxt.HtmlEncode()+'</span>',
						'<span class="song__delete_date">'+item.delete_time+'</span>',
						'</li>'].join(''));
                }

                data.dir_list && $('.js_playlist_list').html(html.join(''));
                $nullCnt.hide();
                $nullsong.hide();
                $playlistCnt.show();
                $songlistCnt.hide();
            }

            function recoverRecyclerList(data, callback) {
                var uin = User.getUin();
                if (uin < 10001) {
                    User.openLogin();
                    return;
                }

                var params = $.extend({
                    uin: uin
                }, data);

                var url = location.protocol + "//c.y.qq.com/folder/fcgi-bin/fcg_fav_recycler_oper.fcg";

                jQueryAjax.json({
                    url:url,
                    data:params,
					charset:'utf-8',
                    type:'post',
                    success: function (data) {
                        if (!data || data.code != 0) {
                            popup.show("网络繁忙，请稍候重试。", 2000, 1);
                            return;
                        }

                        for (var i = 0, l = itemId.length; i < l; i++) {
                            isPlaylist ? $('.js_playlist_item[data-id=' + itemId[i] + ']').remove() : $('.js_songlist_item[data-songid=' + itemId[i] + ']').remove();
                        }

                        typeof callback == 'function' && callback(data);
                    },
                    error: function () {
                        popup.show("网络繁忙，请稍候重试。", 2000, 1);
                    }
                });
            }

            function getPlaylistInfo(global_id, callback) {
                var url = location.protocol + '//c.y.qq.com/folder/fcgi-bin/fcg_fav_recycler_getinfo.fcg?dir_global_id=' + global_id;
                jQueryAjax.json({
                    url: url,
                    charset: 'utf-8',
                    success: function (data) {

                        if (!data || data.code != 0) {
                            return;
                        }
                        typeof callback == 'function' && callback(data.data);
                    },
                    error: function () {
                    }
                });
            }

            function renderSonglist(data){
				var html = [];
                for (var i = 0, l = data.song_list && data.song_list.length; i < l; i++) {
                    var item = data.song_list[i];
                    item.singername = '';
                    item.dir_global_id = data.dir_global_id;
                    for (var j = 0, ll = item.singer && item.singer.length; j < ll; j++) {
                        item.singername = item.singername + (j == 0 ? '' : ' / ') + item.singer[j].name.HtmlEncode();
                    }

                    html.push(['<li class="song__list__item song__list_base js_songlist_item" data-id="'+item.dir_global_id+'" data-songid="'+item.songid+'" data-songtype="'+item.songtype+'">',
                      '<span class="song__select js_item_span_"><input class="select__song js_item_select_" id="'+item.songid+'" name="subBox_" type="checkbox"></span>',
                      '<label class="song__title" for="'+item.songid+'" title="'+item.songname.HtmlEncode()+'">'+item.songname.HtmlEncode()+'</label>',
                      '<span class="song__singer" title="'+item.singername+'">'+item.singername+'</span>',
                      '<span class="song__album" title="'+item.albumname.HtmlEncode()+'">'+item.albumname.HtmlEncode()+'</span>',
                      '</li>'].join(''));
                }
                $('.js_recover_title, .js_song_name').text((data.dir_name || ''));
                $('.js_songlist_intro').text('该歌单中' + data.song_num + '首歌曲可以被恢复，恢复约5至10秒后生效');
                data.song_list && $('.js_song_list').html(html.join(''));
            }

            // 模拟confirm
            function showConfirm(title, desc, btn, cb) {
				g_popup.show(title, desc, btn, cb);
            }

            function bindEvents() {
                $('.js_layout_page').off("click", ".js_playlist_detail").on("click", ".js_playlist_detail", function (evt) {
                    globalId = $(this).closest('li').data('id') || 0;

                    music.util.updateHash({
                        "t1": globalId
                    });
                }).off("click", ".js_item_span").on("click", ".js_item_span", function (evt) {
                    var $curInput = $(this).find('.js_item_select'),
                        $subBox = $("input[name='subBox']");

                    $curInput.is(":checked") ? $curInput.prop("checked", false) : $curInput.prop("checked", true);
                    $(".js_all_select").prop("checked", $subBox.length == $("input[name='subBox']:checked").length ? true : false);
                }).off("click", ".js_item_select").on("click", ".js_item_select", function (evt) {
                    var $subBox = $("input[name='subBox']");

                    $(".js_all_select").prop("checked", $subBox.length == $("input[name='subBox']:checked").length ? true : false);
                    evt.stopPropagation();
                }).off("click", ".js_all_select").on("click", ".js_all_select", function (evt) {
                    $("input[name='subBox']").prop('checked', this.checked);
                }).off("click", ".js_item_span_").on("click", ".js_item_span_", function (evt) {
                    var $curInput = $(this).find('.js_item_select_'),
                        $subBox = $("input[name='subBox_']");

                    $curInput.is(":checked") ? $curInput.prop("checked", false) : $curInput.prop("checked", true);
                    $(".js_all_select_").prop("checked", $subBox.length == $("input[name='subBox_']:checked").length ? true : false);
                }).off("click", ".js_item_select_").on("click", ".js_item_select_", function (evt) {
                    var $subBox = $("input[name='subBox_']");

                    $(".js_all_select_").prop("checked", $subBox.length == $("input[name='subBox_']:checked").length ? true : false);
                    evt.stopPropagation();
                }).off("click", ".js_all_select_").on("click", ".js_all_select_", function (evt) {
                    $("input[name='subBox_']").prop('checked', this.checked);
                }).off("click", ".js_recover_playlist,.js_delete_playlist").on("click", ".js_recover_playlist,.js_delete_playlist", function (evt) {
                    var $t = $(this),
                        params = {opertype: 0, dir_global_id: ''},
                        $subChecked = $("input[name='subBox']:checked");

                    if ($subChecked && $subChecked.length == 0) {
                        return;
                    }

                    itemId = [];
                    isPlaylist = true;
                    params.opertype = $t.data('btntype') ? 3 : 1;
                    $.each($subChecked, function (index) {
                        var $li = $(this).closest('li');
                        itemId.push($li.data('id'));
                        params.dir_global_id = params.dir_global_id + (index == 0 ? '' : ',') + $li.data('id');
                    });

                    if ($t.data('btntype')) {
                        showConfirm('确认要永久性地删除选中的歌单吗？', null, null, function () {
                            recoverRecyclerList(params);
                        });
                        return;
                    }
                    recoverRecyclerList(params, function (data) {
                        popup.show("歌单恢复成功", 2000);

                        if ($('.js_playlist_item').length == 0) {
                            $playlistCnt.hide();
                            $songlistCnt.hide();
                            $nullsong.hide();
                            $nullCnt.show();
                        }
                    });
                    statistics.pgvClickStat($t.data('btntype') ? 'recoverplaylist' : 'deleteplaylist');
                }).off("click", ".js_recover_songlist,.js_delete_songlist").on("click", ".js_recover_songlist,.js_delete_songlist", function (evt) {
                    var $t = $(this),
                        params = {opertype: 0, dir_global_id: '', songid: '', songtype: ''},
                        $subChecked = $("input[name='subBox_']:checked");

                    if ($subChecked && $subChecked.length == 0) {
                        return;
                    }

                    itemId = [];
                    isPlaylist = false;
                    params.opertype = $t.data('btntype') ? 4 : 2;

                    $.each($subChecked, function (index) {
                        var $li = $(this).closest('li');
                        itemId.push($li.data('songid'));
                        params.dir_global_id = $li.data('id');
                        params.songid = params.songid + (index == 0 ? '' : ',') + parseInt($li.data('songid'), 10);
                        params.songtype = params.songtype + (index == 0 ? '' : ',') + parseInt($li.data('songtype'), 10);
                    });

                    if ($t.data('btntype')) {
                        showConfirm('确认要永久性地删除选中的歌曲吗？', null, null, function () {
                            recoverRecyclerList(params, function (data) {
                                if (!$('.js_songlist_item').length) {
                                    $playlistCnt.hide();
                                    $songlistCnt.hide();
                                    $nullCnt.hide();
                                    $nullsong.show();
                                }
                                setTimeout(function () {
                                    $('.js_songlist_intro').text('该歌单中' + $('.js_songlist_item').length + '首歌曲可以被恢复，恢复约5至10秒后生效');
                                }, 0);
                            });
                        });
                        return;
                    }

                    recoverRecyclerList(params, function () {
                        popup.show("歌曲恢复成功", 2000);
                        $('.js_songlist_intro').text('该歌单中' + $('.js_songlist_item').length + '首歌曲可以被恢复，恢复约5至10秒后生效');
                    });
                    statistics.pgvClickStat($t.data('btntype') ? 'recoversonglist' : 'deletesonglist');
                })
            }

            function render(curTab){
                if (curTab == 0) {
                    $nullCnt.hide();
                    $nullsong.hide();
                    $songlistCnt.hide();
                    $playlistCnt.show();
                    $('.js_songlsit_content').find('input').prop("checked", false);
                    getRecyclerList(function (data) {
                        renderRecyclerList(data);
                    });
                } else {
                    $nullCnt.hide();
                    $nullsong.hide();
                    $playlistCnt.hide();
                    $songlistCnt.show();
                    $('.js_playlist_content').find('input').prop("checked", false);
                    getPlaylistInfo(curTab, function (data) {
                        renderSonglist(data);
                    });
                }
            }

            function init() {
				var uin = User.getUin();
                if (uin < 10001) {
                    User.openLogin();
                    return;
                }
                var urlParams = music.util.getUrlParams(),
                    curTab = urlParams["t1"] || 0;

                render(curTab);

                bindEvents();

                music.util.hashChangeInit(function (obj) {
                    //music.saveUrl(window.location.href);
                    render(obj["t1"] || 0);
                });
            }

            init();
        })();
    });
</script>

